import { configureStore } from "@reduxjs/toolkit";

//新增
import { persistReducer } from "redux-persist";
//新增
import storage from "redux-persist/lib/storage";
//新增
import { combineReducers } from "redux";
import counter from "./count";

//新增
const combineRd = combineReducers({
  counter,
});

//新增
const persistConfig = {
  key: "root",
  storage,
};

//新增
const persistedReducer = persistReducer(persistConfig, combineRd);

export default configureStore({
  reducer: persistedReducer, ////新增
  middleware: (getMiddle) => {
    return getMiddle({
      serializableCheck: false,
    });
  },
});
